home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir39 / clipboot.zip / SCREENS.PRG < prev    next >
Text File  |  1993-05-03  |  3KB  |  108 lines

  1. /*┌──────────────────────────────────────────────────────────────────────┐
  2.  ▌│ Program Name: SCREENS.PRG       Copyright: Gallagher Computing Corp. │
  3.  ▌│     Language: Clipper 5.2          Author: Kevin S Gallagher         │
  4.  ▌└──────────────────────────────────────────────────────────────────────┘
  5.  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀           */
  6.  
  7. #include "include1.h"
  8.  
  9. procedure MainScrn()
  10.     dispbox(0,0,maxrow()-2,maxcol(),B_DOUBLE+" ",BACKCOLOR)
  11.     Center(3,"ClipBoot version 1.00",HICOLOR)
  12.     Center(4,"Created by Kevin S. Gallagher",DISPCOLOR)
  13.     @5,27 say "Current Config: "                        color HICOLOR
  14.  
  15.     if !empty( getenv("QBOOTCON") )
  16.         @5,col() say getenv("QBOOTCON")                 color ENCHCOLOR
  17.     else
  18.         @5,col() say "Not available"                    color ENCHCOLOR
  19.     endif
  20.  
  21.     @maxrow()-1,0 say ;
  22.     " Ins-Create   Del-Delete  F3-Environ Editor   "+;
  23.     "F10-BOOT   Esc-Abort   Enter-Edit "                color "gr+/n"
  24.  
  25.     @maxrow(),0 say replicate(" ",80)                   color BACKCOLOR
  26. return
  27.  
  28. /*
  29. * Function..: GetYN() --> logical
  30. * Purpose...: Use to get either a [Y]es or [N]o response for a question
  31. * Returns...: .T. = User pressed Y
  32. *           : .F. = User pressed N
  33. * Comment...: Response is not echoed to the console
  34. */
  35. function GetYN
  36.     local oldcur := setcursor(3)
  37.     while ! upper( chr( inkey(0) ) ) $ "YN" ; enddo
  38.     setcursor( oldcur )
  39. return ( upper(chr(lastkey())) == "Y" )
  40.  
  41. /*
  42. * Procedure.: AbortOp() --> nil  
  43. * Purpose...: Use to terminate the program when an error occurs
  44. *           : Set errorlevel to 3 for check errorlevel from DOS
  45. *           : This is similar to MS-C ABORT() function
  46. * Returns...: NIL
  47. */
  48. procedure AbortOp( cMsg )
  49.     cMsg := if( valtype( cMsg ) == "C", cMsg,"")
  50.     errorlevel(3)
  51.     setcolor(DOSCOLOR)
  52.     cls
  53.     QOut("Abnormal program termination... "+cMsg)
  54.     quit
  55. return
  56.  
  57. /*
  58. * Procedure.: ExitToDos() --> nil
  59. * Purpose...: Use to terminate w/o errors
  60. * Returns...: NIL
  61. */
  62. procedure ExitToDos()
  63.     setcolor(DOSCOLOR)
  64.     cls
  65.     @0,0 say "ClipBoot by: Kevin S. Gallagher" color DOSCOLOR
  66.     quit
  67. return
  68.  
  69.  
  70. /*
  71. * Function..: ALongest() --> Numeric
  72. * Purpose...: Find the longest string in a string array
  73. * Returns...: the length of the longest array element 
  74. *           : or -1 if the passed var was not an array
  75. */
  76. function ALongest( aArr_ )
  77.     local nSize := -1
  78.     if valtype( aArr_ ) == "A"
  79.         nSize := len( aArr_[1] )
  80.         aeval( aArr_, { | a | nSize := if(len(a) > nSize, len(a), nSize ) } )
  81.     endif
  82. return nSize
  83.  
  84. /*
  85. * Function..: AScanner() --> numeric
  86. * Purpose...: case insensitive ascan()
  87. * Returns...: returns a numeric between 0-255
  88. */
  89. function AScanner( aArr_, xValue )
  90.     local xRetVal := ascan( aArr_, { | a | if( ISCHAR( a ), ;
  91.                      upper( subs( a ,1,1) ) = upper( xValue ), .F. ) }, 1 )
  92. return xRetVal
  93.  
  94. /*
  95. * Function..: WaitKeys() --> numeric
  96. * Purpose...: makes inkey() into a wait state
  97. * Returns...: returns a numeric inkey value
  98. */
  99. function WaitKeys( nSecs )
  100.     local nKey, bBlock
  101.     nKey := inkey( nSecs )
  102.     if ( bBlock := setkey(nKey) ) !=NIL
  103.         eval( bBlock, procname(2), procline(2) )
  104.     endif
  105. return ( nKey )
  106.  
  107.  
  108.